#!/bin/sh

INFILE1="./test-files/entrada.txt"
INFILE2="./test-files/cookbook.txt"
INFILE3="./test-files/25demayo.txt"
INFILE4="./test-files/2pac.txt"
INFILE5="./test-files/argentina.txt"


OUTDIR="./mediciones"
OUTFILE="$OUTDIR/resultados_obtenidos.txt"

mkdir -p $OUTDIR
touch $OUTFILE

# Preparo el makefile para hacer el heapsort en c
./configure.sh
echo "Corriendo make para \"C\" heapsort..."
make clean
make generic

echo "Resultados de la ejecucion del tp1:" > $OUTFILE
echo "Ejecutando las pruebas"
echo "" >> $OUTFILE
echo "" >> $OUTFILE
echo "BUBBLESORT:" >> $OUTFILE
echo "Algoritmo BUBBLESORT:"
echo "--------------------------------------" >> $OUTFILE
echo "$INFILE1:" >> $OUTFILE
time ./tp1 -m $INFILE1 1> /dev/null 2>>$OUTFILE
echo "$INFILE1 procesado"
echo "" >> $OUTFILE
echo "$INFILE2:" >> $OUTFILE
time ./tp1 -m $INFILE2 1> /dev/null 2>>$OUTFILE
echo "$INFILE2 procesado"
echo "" >> $OUTFILE
echo "$INFILE3:" >> $OUTFILE
time ./tp1 -m $INFILE3 1> /dev/null 2>>$OUTFILE
echo "$INFILE3 procesado"
echo "" >> $OUTFILE
echo "$INFILE4:" >> $OUTFILE
time ./tp1 -m $INFILE4 1> /dev/null 2>>$OUTFILE
echo "$INFILE4 procesado"
echo "" >> $OUTFILE
echo "$INFILE5:" >> $OUTFILE
time ./tp1 -m $INFILE5 1> /dev/null 2>>$OUTFILE
echo "$INFILE5 procesado"
echo "" >> $OUTFILE
echo "" >> $OUTFILE
echo "" >> $OUTFILE
echo "HEAPSORT C:" >> $OUTFILE
echo "Algoritmo HEAPSORT C:"
echo "--------------------------------------" >> $OUTFILE
echo "$INFILE1:" >> $OUTFILE
time ./tp1 -p $INFILE1 1> /dev/null 2>>$OUTFILE
echo "$INFILE1 procesado"
echo "" >> $OUTFILE
echo "$INFILE2:" >> $OUTFILE
time ./tp1 -p $INFILE2 1> /dev/null 2>>$OUTFILE
echo "$INFILE2 procesado"
echo "" >> $OUTFILE
echo "$INFILE3:" >> $OUTFILE
time ./tp1 -p $INFILE3 1> /dev/null 2>>$OUTFILE
echo "$INFILE3 procesado"
echo "" >> $OUTFILE
echo "$INFILE4:" >> $OUTFILE
time ./tp1 -p $INFILE4 1> /dev/null 2>>$OUTFILE
echo "$INFILE4 procesado"
echo "" >> $OUTFILE
echo "$INFILE5:" >> $OUTFILE
time ./tp1 -p $INFILE5 1> /dev/null 2>>$OUTFILE
echo "$INFILE5 procesado"
echo "" >> $OUTFILE
echo "" >> $OUTFILE
echo "" >> $OUTFILE


# Preparo el makefile para hacer el heapsort en assembly
echo "Corriendo make para \"Assembly\" heapsort..."
make clean
make default
echo "Algoritmo HEAPSORT assembly:"
echo "Algoritmo HEAPSORT assembly:" >> $OUTFILE
echo "--------------------------------------" >> $OUTFILE
echo "$INFILE1:" >> $OUTFILE
time ./tp1 -p $INFILE1 1> /dev/null 2>>$OUTFILE
echo "$INFILE1 procesado"
echo "" >> $OUTFILE
echo "$INFILE2:" >> $OUTFILE
time ./tp1 -p $INFILE2 1> /dev/null 2>>$OUTFILE
echo "$INFILE2 procesado"
echo "" >> $OUTFILE
echo "$INFILE3:" >> $OUTFILE
time ./tp1 -p $INFILE3 1> /dev/null 2>>$OUTFILE
echo "$INFILE3 procesado"
echo "" >> $OUTFILE
echo "$INFILE4:" >> $OUTFILE
time ./tp1 -p $INFILE4 1> /dev/null 2>>$OUTFILE
echo "$INFILE4 procesado"
echo "" >> $OUTFILE
echo "$INFILE5:" >> $OUTFILE
time ./tp1 -p $INFILE5 1> /dev/null 2>>$OUTFILE
echo "$INFILE5 procesado"



echo "Fin de la prueba"
